Conditions | 2 |
Paths | 2 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 2 |
CRAP Score | 3.6875 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | "use strict"; |
||
10 | module.exports = response => { |
||
11 | const format = object => { |
||
12 | 2 | if (object instanceof Response) { |
|
13 | return { |
||
14 | body: object.getBody(), |
||
15 | statusCode: object.getStatusCode(), |
||
16 | headers: object.getHeaders() |
||
17 | }; |
||
18 | } |
||
19 | |||
20 | return object; |
||
21 | }; |
||
22 | |||
23 | 2 | if (Array.isArray(response)) { |
|
24 | return response.map(format); |
||
25 | } |
||
26 | |||
27 | return format(response); |
||
28 | }; |
||
29 |